package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lyw
 * Date: 2025-03-18
 * Time: 10:33
 */
interface IA{
    void test1();
}
public class Test {
    public static void testMethod(){
        //这个局部类实现了IA接口 并且同时重写了test1这个方法
        IA a = new IA(){
            @Override
            public void test1() {
                System.out.println("重写");
            }
        };
        a.test1();
        //局部内部类
        class Inner{
            public int a1;
            public void func(){
                System.out.println("内部类的内部方法");
            }
        }
        Inner inner = new Inner();
        inner.func();
    }
    public static void main(String[] args) {
        OutClass outClass = new OutClass();
        OutClass.InnerClass2 innerClass2 = outClass.new InnerClass2();
        //innerClass2.test();
        testMethod();
    }


    public static void main1(String[] args) {
        //实例化内部类对象
        OutClass.InnerClass innerClass = new OutClass.InnerClass();
        innerClass.test();

    }
}
